home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / utility / blrmu13.zip / DFM.ASM < prev    next >
Assembly Source File  |  1989-06-15  |  2KB  |  76 lines

  1. page ,132
  2. title dfm ( display free memory ) 06/15/89 - 05:45 pm
  3. ;
  4. code     segment para public
  5. ;
  6.          assume cs:code
  7. ;
  8.          org   0                       ; start of PSP
  9. sop      equ   $                       ; start of program
  10.          org   256                     ; start of COM file
  11. ;
  12. go:      jmp   dfm
  13. ;
  14. ;  free memory message
  15. ;
  16. ;
  17. fmm      db    13,10,10,'===> free memory available = '
  18. fma      db    '1234567'
  19.          db    13,10,10,'$'
  20. ;
  21. dfm      proc  near
  22. ;
  23.          mov   bx,(offset eop - sop + 15) shr 4 ; calculate real length
  24. ;
  25.          mov   ah,4ah                  ; modify memory alloc
  26.          int   33                      ; DOS call
  27. ;
  28.          mov   ah,4ah                  ; modify mem alloc
  29.          mov   bx,65535                ; give me all memory
  30.          int   33                      ; DOS call
  31.          mov   ax,bx                   ; save what you really got
  32. ;
  33.          xor   dx,dx                   ; clear hi reg
  34.          mov   dl,ah                   ; save hi value
  35.          mov   cl,4                    ; set for shift 4
  36.          shr   dx,cl                   ; shift hi reg right
  37.          shl   ax,cl                   ; shift lo reg left
  38. ;
  39.          lea   bx,fma                  ; point to dest
  40.          mov   cx,7                    ; set dest limit
  41. ;*
  42. ;* clear free memory area
  43. ;*
  44. cfma:
  45.          mov   byte ptr [bx],32        ; set fill character = space
  46.          inc   bx
  47.          loop  cfma
  48. ;
  49.          dec   bx                      ; back down dest pointer 1
  50.          mov   si,10                   ; set divisor value
  51. ;
  52. dsi:
  53.          div   si                      ; divide by 10
  54.          or    dx,48                   ; make mem ascii
  55.          dec   bx                      ; back down dest pointer
  56.          mov   [bx],dl                 ; move digit
  57.          xor   dx,dx                   ; clear hi reg
  58.          or    ax,ax                   ; test for end
  59.          jnz   dsi                     ; if not, carry on
  60. ;
  61.          lea   dx,fmm                  ; point to msg
  62.          mov   ah,9                    ; print string fct
  63.          int   33                      ; DOS call
  64. ;
  65.          mov   al,0                    ; set return code = 0
  66.          mov   ah,76                   ; exit
  67.          int   33                      ; DOS fct
  68. ;
  69. dfm      endp
  70. ;
  71. eop      equ   $                       ; end of program
  72. ;
  73. code     ends
  74. ;
  75.          end   go
  76.